(0) Obligation:

Clauses:

append(nil, Y, Y).
append(cons(U, V), Y, cons(U, Z)) :- append(V, Y, Z).
lessleaves(nil, cons(W, Z)).
lessleaves(cons(U, V), cons(W, Z)) :- ','(append(U, V, U1), ','(append(W, Z, W1), lessleaves(U1, W1))).

Query: lessleaves(g,g)

(1) PrologToDTProblemTransformerProof (SOUND transformation)

Built DT problem from termination graph DT10.

(2) Obligation:

Triples:

appendC(cons(X1, X2), X3, cons(X1, X4)) :- appendC(X2, X3, X4).
pB(X1, X2, X3, X4) :- appendC(X1, X2, X3).
pB(X1, X2, X3, X4) :- ','(appendcC(X1, X2, X3), lessleavesA(X4, X3)).
lessleavesA(cons(nil, X1), cons(X2, X3)) :- pB(X2, X3, X4, X1).
lessleavesA(cons(cons(X1, X2), X3), cons(X4, X5)) :- appendC(X2, X3, X6).
lessleavesA(cons(cons(X1, X2), X3), cons(X4, X5)) :- ','(appendcC(X2, X3, X6), pB(X4, X5, X7, cons(X1, X6))).

Clauses:

lessleavescA(nil, cons(X1, X2)).
lessleavescA(cons(nil, X1), cons(X2, X3)) :- qcB(X2, X3, X4, X1).
lessleavescA(cons(cons(X1, X2), X3), cons(X4, X5)) :- ','(appendcC(X2, X3, X6), qcB(X4, X5, X7, cons(X1, X6))).
appendcC(nil, X1, X1).
appendcC(cons(X1, X2), X3, cons(X1, X4)) :- appendcC(X2, X3, X4).
qcB(X1, X2, X3, X4) :- ','(appendcC(X1, X2, X3), lessleavescA(X4, X3)).

Afs:

lessleavesA(x1, x2)  =  lessleavesA(x1, x2)

(3) TriplesToPiDPProof (SOUND transformation)

We use the technique of [DT09]. With regard to the inferred argument filtering the predicates were used in the following modes:
lessleavesA_in: (b,b)
pB_in: (b,b,f,b)
appendC_in: (b,b,f)
appendcC_in: (b,b,f)
Transforming TRIPLES into the following Term Rewriting System:
Pi DP problem:
The TRS P consists of the following rules:

LESSLEAVESA_IN_GG(cons(nil, X1), cons(X2, X3)) → U5_GG(X1, X2, X3, pB_in_ggag(X2, X3, X4, X1))
LESSLEAVESA_IN_GG(cons(nil, X1), cons(X2, X3)) → PB_IN_GGAG(X2, X3, X4, X1)
PB_IN_GGAG(X1, X2, X3, X4) → U2_GGAG(X1, X2, X3, X4, appendC_in_gga(X1, X2, X3))
PB_IN_GGAG(X1, X2, X3, X4) → APPENDC_IN_GGA(X1, X2, X3)
APPENDC_IN_GGA(cons(X1, X2), X3, cons(X1, X4)) → U1_GGA(X1, X2, X3, X4, appendC_in_gga(X2, X3, X4))
APPENDC_IN_GGA(cons(X1, X2), X3, cons(X1, X4)) → APPENDC_IN_GGA(X2, X3, X4)
PB_IN_GGAG(X1, X2, X3, X4) → U3_GGAG(X1, X2, X3, X4, appendcC_in_gga(X1, X2, X3))
U3_GGAG(X1, X2, X3, X4, appendcC_out_gga(X1, X2, X3)) → U4_GGAG(X1, X2, X3, X4, lessleavesA_in_gg(X4, X3))
U3_GGAG(X1, X2, X3, X4, appendcC_out_gga(X1, X2, X3)) → LESSLEAVESA_IN_GG(X4, X3)
LESSLEAVESA_IN_GG(cons(cons(X1, X2), X3), cons(X4, X5)) → U6_GG(X1, X2, X3, X4, X5, appendC_in_gga(X2, X3, X6))
LESSLEAVESA_IN_GG(cons(cons(X1, X2), X3), cons(X4, X5)) → APPENDC_IN_GGA(X2, X3, X6)
LESSLEAVESA_IN_GG(cons(cons(X1, X2), X3), cons(X4, X5)) → U7_GG(X1, X2, X3, X4, X5, appendcC_in_gga(X2, X3, X6))
U7_GG(X1, X2, X3, X4, X5, appendcC_out_gga(X2, X3, X6)) → U8_GG(X1, X2, X3, X4, X5, pB_in_ggag(X4, X5, X7, cons(X1, X6)))
U7_GG(X1, X2, X3, X4, X5, appendcC_out_gga(X2, X3, X6)) → PB_IN_GGAG(X4, X5, X7, cons(X1, X6))

The TRS R consists of the following rules:

appendcC_in_gga(nil, X1, X1) → appendcC_out_gga(nil, X1, X1)
appendcC_in_gga(cons(X1, X2), X3, cons(X1, X4)) → U13_gga(X1, X2, X3, X4, appendcC_in_gga(X2, X3, X4))
U13_gga(X1, X2, X3, X4, appendcC_out_gga(X2, X3, X4)) → appendcC_out_gga(cons(X1, X2), X3, cons(X1, X4))

The argument filtering Pi contains the following mapping:
lessleavesA_in_gg(x1, x2)  =  lessleavesA_in_gg(x1, x2)
cons(x1, x2)  =  cons(x1, x2)
nil  =  nil
pB_in_ggag(x1, x2, x3, x4)  =  pB_in_ggag(x1, x2, x4)
appendC_in_gga(x1, x2, x3)  =  appendC_in_gga(x1, x2)
appendcC_in_gga(x1, x2, x3)  =  appendcC_in_gga(x1, x2)
appendcC_out_gga(x1, x2, x3)  =  appendcC_out_gga(x1, x2, x3)
U13_gga(x1, x2, x3, x4, x5)  =  U13_gga(x1, x2, x3, x5)
LESSLEAVESA_IN_GG(x1, x2)  =  LESSLEAVESA_IN_GG(x1, x2)
U5_GG(x1, x2, x3, x4)  =  U5_GG(x1, x2, x3, x4)
PB_IN_GGAG(x1, x2, x3, x4)  =  PB_IN_GGAG(x1, x2, x4)
U2_GGAG(x1, x2, x3, x4, x5)  =  U2_GGAG(x1, x2, x4, x5)
APPENDC_IN_GGA(x1, x2, x3)  =  APPENDC_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3, x4, x5)  =  U1_GGA(x1, x2, x3, x5)
U3_GGAG(x1, x2, x3, x4, x5)  =  U3_GGAG(x1, x2, x4, x5)
U4_GGAG(x1, x2, x3, x4, x5)  =  U4_GGAG(x1, x2, x3, x4, x5)
U6_GG(x1, x2, x3, x4, x5, x6)  =  U6_GG(x1, x2, x3, x4, x5, x6)
U7_GG(x1, x2, x3, x4, x5, x6)  =  U7_GG(x1, x2, x3, x4, x5, x6)
U8_GG(x1, x2, x3, x4, x5, x6)  =  U8_GG(x1, x2, x3, x4, x5, x6)

We have to consider all (P,R,Pi)-chains

Infinitary Constructor Rewriting Termination of PiDP implies Termination of TRIPLES

(4) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

LESSLEAVESA_IN_GG(cons(nil, X1), cons(X2, X3)) → U5_GG(X1, X2, X3, pB_in_ggag(X2, X3, X4, X1))
LESSLEAVESA_IN_GG(cons(nil, X1), cons(X2, X3)) → PB_IN_GGAG(X2, X3, X4, X1)
PB_IN_GGAG(X1, X2, X3, X4) → U2_GGAG(X1, X2, X3, X4, appendC_in_gga(X1, X2, X3))
PB_IN_GGAG(X1, X2, X3, X4) → APPENDC_IN_GGA(X1, X2, X3)
APPENDC_IN_GGA(cons(X1, X2), X3, cons(X1, X4)) → U1_GGA(X1, X2, X3, X4, appendC_in_gga(X2, X3, X4))
APPENDC_IN_GGA(cons(X1, X2), X3, cons(X1, X4)) → APPENDC_IN_GGA(X2, X3, X4)
PB_IN_GGAG(X1, X2, X3, X4) → U3_GGAG(X1, X2, X3, X4, appendcC_in_gga(X1, X2, X3))
U3_GGAG(X1, X2, X3, X4, appendcC_out_gga(X1, X2, X3)) → U4_GGAG(X1, X2, X3, X4, lessleavesA_in_gg(X4, X3))
U3_GGAG(X1, X2, X3, X4, appendcC_out_gga(X1, X2, X3)) → LESSLEAVESA_IN_GG(X4, X3)
LESSLEAVESA_IN_GG(cons(cons(X1, X2), X3), cons(X4, X5)) → U6_GG(X1, X2, X3, X4, X5, appendC_in_gga(X2, X3, X6))
LESSLEAVESA_IN_GG(cons(cons(X1, X2), X3), cons(X4, X5)) → APPENDC_IN_GGA(X2, X3, X6)
LESSLEAVESA_IN_GG(cons(cons(X1, X2), X3), cons(X4, X5)) → U7_GG(X1, X2, X3, X4, X5, appendcC_in_gga(X2, X3, X6))
U7_GG(X1, X2, X3, X4, X5, appendcC_out_gga(X2, X3, X6)) → U8_GG(X1, X2, X3, X4, X5, pB_in_ggag(X4, X5, X7, cons(X1, X6)))
U7_GG(X1, X2, X3, X4, X5, appendcC_out_gga(X2, X3, X6)) → PB_IN_GGAG(X4, X5, X7, cons(X1, X6))

The TRS R consists of the following rules:

appendcC_in_gga(nil, X1, X1) → appendcC_out_gga(nil, X1, X1)
appendcC_in_gga(cons(X1, X2), X3, cons(X1, X4)) → U13_gga(X1, X2, X3, X4, appendcC_in_gga(X2, X3, X4))
U13_gga(X1, X2, X3, X4, appendcC_out_gga(X2, X3, X4)) → appendcC_out_gga(cons(X1, X2), X3, cons(X1, X4))

The argument filtering Pi contains the following mapping:
lessleavesA_in_gg(x1, x2)  =  lessleavesA_in_gg(x1, x2)
cons(x1, x2)  =  cons(x1, x2)
nil  =  nil
pB_in_ggag(x1, x2, x3, x4)  =  pB_in_ggag(x1, x2, x4)
appendC_in_gga(x1, x2, x3)  =  appendC_in_gga(x1, x2)
appendcC_in_gga(x1, x2, x3)  =  appendcC_in_gga(x1, x2)
appendcC_out_gga(x1, x2, x3)  =  appendcC_out_gga(x1, x2, x3)
U13_gga(x1, x2, x3, x4, x5)  =  U13_gga(x1, x2, x3, x5)
LESSLEAVESA_IN_GG(x1, x2)  =  LESSLEAVESA_IN_GG(x1, x2)
U5_GG(x1, x2, x3, x4)  =  U5_GG(x1, x2, x3, x4)
PB_IN_GGAG(x1, x2, x3, x4)  =  PB_IN_GGAG(x1, x2, x4)
U2_GGAG(x1, x2, x3, x4, x5)  =  U2_GGAG(x1, x2, x4, x5)
APPENDC_IN_GGA(x1, x2, x3)  =  APPENDC_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3, x4, x5)  =  U1_GGA(x1, x2, x3, x5)
U3_GGAG(x1, x2, x3, x4, x5)  =  U3_GGAG(x1, x2, x4, x5)
U4_GGAG(x1, x2, x3, x4, x5)  =  U4_GGAG(x1, x2, x3, x4, x5)
U6_GG(x1, x2, x3, x4, x5, x6)  =  U6_GG(x1, x2, x3, x4, x5, x6)
U7_GG(x1, x2, x3, x4, x5, x6)  =  U7_GG(x1, x2, x3, x4, x5, x6)
U8_GG(x1, x2, x3, x4, x5, x6)  =  U8_GG(x1, x2, x3, x4, x5, x6)

We have to consider all (P,R,Pi)-chains

(5) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 2 SCCs with 8 less nodes.

(6) Complex Obligation (AND)

(7) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

APPENDC_IN_GGA(cons(X1, X2), X3, cons(X1, X4)) → APPENDC_IN_GGA(X2, X3, X4)

The TRS R consists of the following rules:

appendcC_in_gga(nil, X1, X1) → appendcC_out_gga(nil, X1, X1)
appendcC_in_gga(cons(X1, X2), X3, cons(X1, X4)) → U13_gga(X1, X2, X3, X4, appendcC_in_gga(X2, X3, X4))
U13_gga(X1, X2, X3, X4, appendcC_out_gga(X2, X3, X4)) → appendcC_out_gga(cons(X1, X2), X3, cons(X1, X4))

The argument filtering Pi contains the following mapping:
cons(x1, x2)  =  cons(x1, x2)
nil  =  nil
appendcC_in_gga(x1, x2, x3)  =  appendcC_in_gga(x1, x2)
appendcC_out_gga(x1, x2, x3)  =  appendcC_out_gga(x1, x2, x3)
U13_gga(x1, x2, x3, x4, x5)  =  U13_gga(x1, x2, x3, x5)
APPENDC_IN_GGA(x1, x2, x3)  =  APPENDC_IN_GGA(x1, x2)

We have to consider all (P,R,Pi)-chains

(8) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(9) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

APPENDC_IN_GGA(cons(X1, X2), X3, cons(X1, X4)) → APPENDC_IN_GGA(X2, X3, X4)

R is empty.
The argument filtering Pi contains the following mapping:
cons(x1, x2)  =  cons(x1, x2)
APPENDC_IN_GGA(x1, x2, x3)  =  APPENDC_IN_GGA(x1, x2)

We have to consider all (P,R,Pi)-chains

(10) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(11) Obligation:

Q DP problem:
The TRS P consists of the following rules:

APPENDC_IN_GGA(cons(X1, X2), X3) → APPENDC_IN_GGA(X2, X3)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(12) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • APPENDC_IN_GGA(cons(X1, X2), X3) → APPENDC_IN_GGA(X2, X3)
    The graph contains the following edges 1 > 1, 2 >= 2

(13) YES

(14) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

LESSLEAVESA_IN_GG(cons(nil, X1), cons(X2, X3)) → PB_IN_GGAG(X2, X3, X4, X1)
PB_IN_GGAG(X1, X2, X3, X4) → U3_GGAG(X1, X2, X3, X4, appendcC_in_gga(X1, X2, X3))
U3_GGAG(X1, X2, X3, X4, appendcC_out_gga(X1, X2, X3)) → LESSLEAVESA_IN_GG(X4, X3)
LESSLEAVESA_IN_GG(cons(cons(X1, X2), X3), cons(X4, X5)) → U7_GG(X1, X2, X3, X4, X5, appendcC_in_gga(X2, X3, X6))
U7_GG(X1, X2, X3, X4, X5, appendcC_out_gga(X2, X3, X6)) → PB_IN_GGAG(X4, X5, X7, cons(X1, X6))

The TRS R consists of the following rules:

appendcC_in_gga(nil, X1, X1) → appendcC_out_gga(nil, X1, X1)
appendcC_in_gga(cons(X1, X2), X3, cons(X1, X4)) → U13_gga(X1, X2, X3, X4, appendcC_in_gga(X2, X3, X4))
U13_gga(X1, X2, X3, X4, appendcC_out_gga(X2, X3, X4)) → appendcC_out_gga(cons(X1, X2), X3, cons(X1, X4))

The argument filtering Pi contains the following mapping:
cons(x1, x2)  =  cons(x1, x2)
nil  =  nil
appendcC_in_gga(x1, x2, x3)  =  appendcC_in_gga(x1, x2)
appendcC_out_gga(x1, x2, x3)  =  appendcC_out_gga(x1, x2, x3)
U13_gga(x1, x2, x3, x4, x5)  =  U13_gga(x1, x2, x3, x5)
LESSLEAVESA_IN_GG(x1, x2)  =  LESSLEAVESA_IN_GG(x1, x2)
PB_IN_GGAG(x1, x2, x3, x4)  =  PB_IN_GGAG(x1, x2, x4)
U3_GGAG(x1, x2, x3, x4, x5)  =  U3_GGAG(x1, x2, x4, x5)
U7_GG(x1, x2, x3, x4, x5, x6)  =  U7_GG(x1, x2, x3, x4, x5, x6)

We have to consider all (P,R,Pi)-chains

(15) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(16) Obligation:

Q DP problem:
The TRS P consists of the following rules:

LESSLEAVESA_IN_GG(cons(nil, X1), cons(X2, X3)) → PB_IN_GGAG(X2, X3, X1)
PB_IN_GGAG(X1, X2, X4) → U3_GGAG(X1, X2, X4, appendcC_in_gga(X1, X2))
U3_GGAG(X1, X2, X4, appendcC_out_gga(X1, X2, X3)) → LESSLEAVESA_IN_GG(X4, X3)
LESSLEAVESA_IN_GG(cons(cons(X1, X2), X3), cons(X4, X5)) → U7_GG(X1, X2, X3, X4, X5, appendcC_in_gga(X2, X3))
U7_GG(X1, X2, X3, X4, X5, appendcC_out_gga(X2, X3, X6)) → PB_IN_GGAG(X4, X5, cons(X1, X6))

The TRS R consists of the following rules:

appendcC_in_gga(nil, X1) → appendcC_out_gga(nil, X1, X1)
appendcC_in_gga(cons(X1, X2), X3) → U13_gga(X1, X2, X3, appendcC_in_gga(X2, X3))
U13_gga(X1, X2, X3, appendcC_out_gga(X2, X3, X4)) → appendcC_out_gga(cons(X1, X2), X3, cons(X1, X4))

The set Q consists of the following terms:

appendcC_in_gga(x0, x1)
U13_gga(x0, x1, x2, x3)

We have to consider all (P,Q,R)-chains.

(17) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04,JAR06].


The following pairs can be oriented strictly and are deleted.


LESSLEAVESA_IN_GG(cons(nil, X1), cons(X2, X3)) → PB_IN_GGAG(X2, X3, X1)
LESSLEAVESA_IN_GG(cons(cons(X1, X2), X3), cons(X4, X5)) → U7_GG(X1, X2, X3, X4, X5, appendcC_in_gga(X2, X3))
The remaining pairs can at least be oriented weakly.
Used ordering: Polynomial interpretation [POLO]:

POL(LESSLEAVESA_IN_GG(x1, x2)) = 1 + x2   
POL(PB_IN_GGAG(x1, x2, x3)) = x1 + x2   
POL(U13_gga(x1, x2, x3, x4)) = x1 + x4   
POL(U3_GGAG(x1, x2, x3, x4)) = x4   
POL(U7_GG(x1, x2, x3, x4, x5, x6)) = x4 + x5   
POL(appendcC_in_gga(x1, x2)) = x1 + x2   
POL(appendcC_out_gga(x1, x2, x3)) = 1 + x3   
POL(cons(x1, x2)) = x1 + x2   
POL(nil) = 1   

The following usable rules [FROCOS05] with respect to the argument filtering of the ordering [JAR06] were oriented:

appendcC_in_gga(nil, X1) → appendcC_out_gga(nil, X1, X1)
appendcC_in_gga(cons(X1, X2), X3) → U13_gga(X1, X2, X3, appendcC_in_gga(X2, X3))
U13_gga(X1, X2, X3, appendcC_out_gga(X2, X3, X4)) → appendcC_out_gga(cons(X1, X2), X3, cons(X1, X4))

(18) Obligation:

Q DP problem:
The TRS P consists of the following rules:

PB_IN_GGAG(X1, X2, X4) → U3_GGAG(X1, X2, X4, appendcC_in_gga(X1, X2))
U3_GGAG(X1, X2, X4, appendcC_out_gga(X1, X2, X3)) → LESSLEAVESA_IN_GG(X4, X3)
U7_GG(X1, X2, X3, X4, X5, appendcC_out_gga(X2, X3, X6)) → PB_IN_GGAG(X4, X5, cons(X1, X6))

The TRS R consists of the following rules:

appendcC_in_gga(nil, X1) → appendcC_out_gga(nil, X1, X1)
appendcC_in_gga(cons(X1, X2), X3) → U13_gga(X1, X2, X3, appendcC_in_gga(X2, X3))
U13_gga(X1, X2, X3, appendcC_out_gga(X2, X3, X4)) → appendcC_out_gga(cons(X1, X2), X3, cons(X1, X4))

The set Q consists of the following terms:

appendcC_in_gga(x0, x1)
U13_gga(x0, x1, x2, x3)

We have to consider all (P,Q,R)-chains.

(19) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 0 SCCs with 3 less nodes.

(20) TRUE